package main

import (
	"Head-first-go/chapter06/example8/huajianlistruct"
	"fmt"
)

func main() {
	var s huajianlistruct.Subcriber
	s.Name = "hujianli"
	s.Rate = 3.14
	s.Active = true
	fmt.Println("Name:", s.Name)
	fmt.Println("Rate:", s.Rate)
	fmt.Println("Active:", s.Active)

	fmt.Println()
	s1 := huajianlistruct.Subcriber{
		Name:   "hjl",
		Rate:   12.34,
		Active: false,
	}
	fmt.Println("Name:", s1.Name)
	fmt.Println("Rate:", s1.Rate)
	fmt.Println("Active:", s1.Active)

	fmt.Println()

	s2 := huajianlistruct.Subcriber{
		Rate: 1.23454,
	}
	fmt.Println("Name:", s2.Name)
	fmt.Println("Rate:", s2.Rate)
	fmt.Println("Active:", s2.Active)

	s3 := huajianlistruct.Employee{
		Name:   "hujianli1",
		Salary: 20000,
	}
	fmt.Println(s3.Name)
	fmt.Println(s3.Salary)

	fmt.Println()
	address := huajianlistruct.Address{
		Street:     "123",
		City:       "sz",
		State:      "UP",
		PostalCode: "68111",
	}
	fmt.Println(address)
	fmt.Println()
	shu := huajianlistruct.Subcriber{Name: "hujianli123"}
	shu.Address.Street = "321"
	shu.Address.City = "shenzhen"
	shu.Address.State = "up"
	shu.Address.PostalCode = "432416"
	fmt.Printf("%T\n", shu)
	fmt.Printf("%v\n", shu)
	fmt.Printf("%#v\n", shu)

	// shu.HomeAddress = address
	// fmt.Println(shu.HomeAddress)
	// fmt.Println(shu.HomeAddress.City)
	// fmt.Println(shu.HomeAddress.State)

	fmt.Println()
	s1hu := huajianlistruct.Subcriber{}
	fmt.Printf("%#v\n", s1hu.Address)
	fmt.Println()

	s2hu := huajianlistruct.Subcriber{Name: "Subcriberhujianli"}
	s2hu.Street = "123 ok ~! St"
	s2hu.City = "sz-ft"
	s2hu.State = "upup"
	s2hu.PostalCode = "68111"
	fmt.Println("Street:", s2hu.Street)
	fmt.Println("City:", s2hu.City)
	fmt.Println("State:", s2hu.State)
	fmt.Println("PostalCode:", s2hu.PostalCode)
	fmt.Println(s2hu)
	fmt.Println()
	s3hu := huajianlistruct.Employee{Name: "Employeehujianli"}
	s3hu.Street = "123 ok ~! Employee"
	s3hu.City = "sz-ft"
	s3hu.State = "upup"
	s3hu.PostalCode = "68000"
	fmt.Println("Street:", s3hu.Street)
	fmt.Println("City:", s3hu.City)
	fmt.Println("State:", s3hu.State)
	fmt.Println("PostalCode:", s3hu.PostalCode)
	fmt.Println(s3hu)
}
